/*
 * Copyright (c) 2010, Yawning <yawninglol at gmail.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   * Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 *   * Neither the name of the Mew Developers nor the
 *     names of its contributors may be used to endorse or promote products
 *     derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

package yawning.mew.character;

import java.util.HashSet;
import java.util.Set;

import yawning.mew.PropertiesBase.IProperty;

/**
 * Base Character Definition.
 *
 * @author Yawning <yawninglol at gmail.com>
 */
public class Toon {
    public int level;
    public Clazz mClass;
    public Race mRace;

    public int strength;
    public int agility;
    public int stamina;
    public int intellect;
    public int spirit;
    public int armor;

    public int attackPower;
    public int hasteRating;
    public int critRating;
    public int hitRating;
    public int expertiseRating;
    public int masteryRating;

    public int weaponTop;
    public int weaponBottom;
    public int weaponSpeed;

    // TODO: There should be a cleaner way to handle tier bonus
    public boolean tier_10_2pc;
    public boolean tier_10_4pc;
    public boolean tier_11_2pc;
    public boolean tier_11_4pc;
    
    public boolean isArmorSpec;
    public MetaGem mMetaGem;
    public TalentTree mTalentSpec;

    Set<Glyph> glyphs = new HashSet<Glyph>();
    byte[] talents = new byte[100];

    public boolean hasGlyph(Glyph g) {
        return glyphs.contains(g);
    }

    public int getTalent(Talent t) {
    	return talents[t.mTalentNumber];
    }

    @Override
    public String toString() {
    	StringBuffer sb = new StringBuffer();
    	
    	sb.append("Level: ").append(level).append('\n');
    	sb.append("Class: ").append(mClass).append('\n');
    	sb.append("Race: ").append(mRace.getName()).append('\n');
    	
    	sb.append("Strength: ").append(strength).append('\n');
    	sb.append("Agility: ").append(agility).append('\n');
    	sb.append("Stamina: ").append(stamina).append('\n');
    	sb.append("Intellect: ").append(intellect).append('\n');
    	sb.append("Spirit: ").append(spirit).append('\n');
    	sb.append("Armor: ").append(armor).append('\n');

    	sb.append("Attack Power: ").append(attackPower).append('\n');
    	sb.append("Haste Rating: ").append(hasteRating).append('\n');
    	sb.append("Crit Rating: ").append(critRating).append('\n');
    	sb.append("Hit Rating: ").append(hitRating).append('\n');
    	sb.append("Expertise Rating: ").append(expertiseRating).append('\n');
    	sb.append("Mastery Rating: ").append(masteryRating).append('\n');

    	sb.append("Weapon Top: ").append(weaponTop).append('\n');
    	sb.append("Weapon Bottom: ").append(weaponBottom).append('\n');
    	sb.append("Weapon Speed: ").append(weaponSpeed).append('\n');
    	
    	return sb.toString();
    }
}
